package cn.tedu.mintmall.controller;

import cn.tedu.mintmall.dto.StockReduceCountDTO;
import cn.tedu.mintmall.restful.JsonResult;
import cn.tedu.mintmall.service.IStockService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/stock")
@Api(tags = "库存管理")
public class StockController {

    @Autowired
    private IStockService stockService;

    @PostMapping("/reduce/count")
    @ApiOperation("减少商品库存业务")
    public JsonResult<Void> reduceProductCount(StockReduceCountDTO stockReduceCountDTO){
        stockService.reduceProductCount(stockReduceCountDTO);
        return JsonResult.ok("商品库存减少完成");
    }


}
